﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Web.Security;

namespace SecurityService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public bool checkLogin(String username, String password)
        {
            return Membership.ValidateUser(username, password);
        }

        [WebMethod]
        public MembershipUser getUser(String username)
        {
            MembershipUser user = Membership.GetUser(username);
            return user;
        }

        [WebMethod]
        public void createUser(String username, String password)
        {
            Membership.CreateUser(username, password);
        }

        [WebMethod]
        public void addUsertoRole(String username, String role)
        {
            Roles.AddUserToRole(username, role);
        }

        [WebMethod]
        public void addRole(String role)
        {
            Roles.CreateRole(role);
        }

        [WebMethod]
        public String[] getUserRole(String username)
        {
            return Roles.GetRolesForUser(username);
        }

        [WebMethod]
        public void addReport(String report)
        {
         
        }

        [WebMethod]
        public String[] getReportsForUser(String username)
        {
            return Roles.GetRolesForUser(username);
        }
    }
}
